package com.ruoyi.teaching.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.teaching.mapper.TeachingClassesMapper;
import com.ruoyi.teaching.domain.TeachingClasses;
import com.ruoyi.teaching.service.ITeachingClassesService;
import com.ruoyi.common.core.text.Convert;

/**
 * 教务班级Service业务层处理
 *
 * @author ruoyi
 * @date 2022-10-12
 */
@Service
public class TeachingClassesServiceImpl implements ITeachingClassesService {
    @Autowired
    private TeachingClassesMapper teachingClassesMapper;

    /**
     * 查询教务班级
     *
     * @param classId 教务班级主键
     * @return 教务班级
     */
    @Override
    public TeachingClasses selectTeachingClassesByClassId(Long classId) {
        return teachingClassesMapper.selectTeachingClassesByClassId(classId);
    }

    /**
     * 查询教务班级列表
     *
     * @param teachingClasses 教务班级
     * @return 教务班级
     */
    @Override
    public List<TeachingClasses> selectTeachingClassesList(TeachingClasses teachingClasses) {
        return teachingClassesMapper.selectTeachingClassesList(teachingClasses);
    }

    /**
     * 新增教务班级
     *
     * @param teachingClasses 教务班级
     * @return 结果
     */
    @Override
    public int insertTeachingClasses(TeachingClasses teachingClasses) {
        teachingClasses.setCreateTime(DateUtils.getNowDate());
        return teachingClassesMapper.insertTeachingClasses(teachingClasses);
    }

    /**
     * 修改教务班级
     *
     * @param teachingClasses 教务班级
     * @return 结果
     */
    @Override
    public int updateTeachingClasses(TeachingClasses teachingClasses) {
        teachingClasses.setUpdateTime(DateUtils.getNowDate());
        return teachingClassesMapper.updateTeachingClasses(teachingClasses);
    }

    /**
     * 批量删除教务班级
     *
     * @param classIds 需要删除的教务班级主键
     * @return 结果
     */
    @Override
    public int deleteTeachingClassesByClassIds(String classIds) {
        return teachingClassesMapper.deleteTeachingClassesByClassIds(Convert.toStrArray(classIds));
    }

    /**
     * 删除教务班级信息
     *
     * @param classId 教务班级主键
     * @return 结果
     */
    @Override
    public int deleteTeachingClassesByClassId(Long classId) {
        return teachingClassesMapper.deleteTeachingClassesByClassId(classId);
    }

    /**
     * 查看当前老师需要教学的所有课程
     *
     * @param teacherId
     * @return
     */
    @Override
    public List<TeachingClasses> selectTeachingClassesByTeacherId(Long teacherId) {
        return teachingClassesMapper.selectTeachingClassesByTeacherId(teacherId);
    }
}
